package com.sync.platform.entity;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import lombok.EqualsAndHashCode;

import java.time.LocalDateTime;

/**
 * Synchronization task entity
 */
@Data
@EqualsAndHashCode(callSuper = true)
@TableName("sync_task")
public class SyncTask extends BaseEntity {

    /**
     * Task name
     */
    @TableField("name")
    private String name;

    /**
     * Task type (1: database sync, 2: file sync)
     */
    @TableField("task_type")
    private Integer taskType;

    /**
     * Source configuration ID (database or server)
     */
    @TableField("source_id")
    private Long sourceId;

    /**
     * Target configuration ID (database or server)
     */
    @TableField("target_id")
    private Long targetId;

    /**
     * Configuration details in JSON format For database sync: tables, columns,
     * where conditions, etc. For file sync: source path, target path, file
     * patterns, etc.
     */
    @TableField("config")
    private String config;

    /**
     * Cron expression for scheduled execution
     */
    @TableField("cron_expression")
    private String cronExpression;

    /**
     * Task status (0: disabled, 1: enabled)
     */
    @TableField("status")
    private Integer status;

    /**
     * Last execution time
     */
    @TableField("last_execution_time")
    private LocalDateTime lastExecutionTime;

    /**
     * Last execution result (0: failed, 1: successful)
     */
    @TableField("last_execution_result")
    private Integer lastExecutionResult;

    /**
     * Last execution message (error message or success summary)
     */
    @TableField("last_execution_message")
    private String lastExecutionMessage;

    /**
     * Last successful execution time (for incremental sync)
     */
    @TableField("last_success_time")
    private LocalDateTime lastSuccessTime;
}
